@inherits FilterBase

<Select Items="@Items" @bind-Value="@Value" OnSelectedItemChanged="_ => OnFilterValueChanged()"></Select>

@code {
    private int Value = 0;

    /// <summary>
    /// OnInitialized 方法
    /// </summary>
    protected override void OnInitialized()
    {
        base.OnInitialized();

        if (TableFilter != null) TableFilter.ShowMoreButton = false;

        Items = new SelectedItem[]
        {
            new SelectedItem { Value = "0", Text = "全部" },
            new SelectedItem { Value = "1", Text = "已完成" },
            new SelectedItem { Value = "2", Text = "未完成" },
        };
    }

    /// <summary>
    /// 重置过滤条件方法
    /// </summary>
    public override void Reset()
    {
        Value = 0;

        StateHasChanged();
    }

    /// <summary>
    /// 生成过滤条件方法
    /// </summary>
    /// <returns></returns>
    public override FilterKeyValueAction GetFilterConditions()
    {
        var filter = new FilterKeyValueAction() { Filters = new() };
        filter.Filters.Add(new FilterKeyValueAction()
        {
            FieldKey = FieldKey,
            FieldValue = getValueString(Value),
            FilterAction = FilterAction.GreaterThan
        });
        return filter;
    }

    public bool getValueString(int value)
    {
        switch (value)
        {
            case 1:
                return true;
            case 2:
                return false;
            default:
                return false;
        }
    }
}
